{
 "cells": [
  {
   "metadata": {},
   "cell_type": "markdown",
   "source": "## Numpy",
   "id": "cc21e24c303ab986"
  },
  {
   "metadata": {},
   "cell_type": "markdown",
   "source": [
    "NumPy（Numerical Python）是一个开源 Python 库，几乎用于科学和工程的每个领域。 它是在 Python 中处理数值数据的通用标准，也是科学 Python 和 PyData 生态系统的核心。 NumPy 用户包括从初级编码员到从事最先进的科学和工业研发的经验丰富的研究人员的所有人。 NumPy API 广泛用于 Pandas、SciPy、Matplotlib、scikit-learn、scikit-image 和大多数其他数据科学和科学 Python 包。\n",
    "\n",
    "NumPy 库包含多维数组和矩阵数据结构。 它提供了 ndarray，一个同构的$n$维数组对象，以及对其进行有效操作的方法。 NumPy 可用于对数组执行各种数学运算。 它为 Python 添加了强大的数据结构，保证了数组和矩阵的高效计算，并提供了一个庞大的高级数学函数库，可以对这些数组和矩阵进行运算。"
   ],
   "id": "63896486785c5833"
  },
  {
   "metadata": {
    "collapsed": true,
    "ExecuteTime": {
     "end_time": "2025-01-25T12:41:19.249649Z",
     "start_time": "2025-01-25T12:41:19.134929Z"
    }
   },
   "cell_type": "code",
   "outputs": [],
   "execution_count": 1,
   "source": "import numpy as np",
   "id": "initial_id"
  },
  {
   "metadata": {},
   "cell_type": "markdown",
   "source": "#### Numpy的基本使用",
   "id": "5d8870f5a23f4b7e"
  },
  {
   "metadata": {
    "ExecuteTime": {
     "end_time": "2025-01-25T12:41:21.847761Z",
     "start_time": "2025-01-25T12:41:21.839672Z"
    }
   },
   "cell_type": "code",
   "source": [
    "# 可以从一个list构造ndarray\n",
    "l = [1, 2, 3]\n",
    "arr = np.array(l)\n",
    "l, arr"
   ],
   "id": "237de74cb04da09f",
   "outputs": [
    {
     "data": {
      "text/plain": [
       "([1, 2, 3], array([1, 2, 3]))"
      ]
     },
     "execution_count": 2,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "execution_count": 2
  },
  {
   "metadata": {
    "ExecuteTime": {
     "end_time": "2025-01-25T12:41:22.345384Z",
     "start_time": "2025-01-25T12:41:22.340373Z"
    }
   },
   "cell_type": "code",
   "source": [
    "# numpy的使用基本类型ndarray代表多维数组\n",
    "type(l), type(arr)"
   ],
   "id": "d46ff0a4611c15",
   "outputs": [
    {
     "data": {
      "text/plain": [
       "(list, numpy.ndarray)"
      ]
     },
     "execution_count": 3,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "execution_count": 3
  },
  {
   "metadata": {
    "ExecuteTime": {
     "end_time": "2025-01-25T12:41:22.871022Z",
     "start_time": "2025-01-25T12:41:22.867535Z"
    }
   },
   "cell_type": "code",
   "source": [
    "# 二维\n",
    "l = [[1, 2, 3], [4, 5, 6]]\n",
    "arr = np.array(l)"
   ],
   "id": "e6f1b7185f8f5d03",
   "outputs": [],
   "execution_count": 4
  },
  {
   "metadata": {
    "ExecuteTime": {
     "end_time": "2025-01-25T12:41:24.034283Z",
     "start_time": "2025-01-25T12:41:24.028625Z"
    }
   },
   "cell_type": "code",
   "source": "l, arr",
   "id": "1d90b82762ac1f4e",
   "outputs": [
    {
     "data": {
      "text/plain": [
       "([[1, 2, 3], [4, 5, 6]],\n",
       " array([[1, 2, 3],\n",
       "        [4, 5, 6]]))"
      ]
     },
     "execution_count": 5,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "execution_count": 5
  },
  {
   "metadata": {
    "ExecuteTime": {
     "end_time": "2025-01-25T12:41:24.575536Z",
     "start_time": "2025-01-25T12:41:24.570484Z"
    }
   },
   "cell_type": "code",
   "source": [
    "# 可以通过ndarray.dtype类型获取该ndarray每个元素的类型（同C语言一样，所有元素的类型都一样，由dtype指定）\n",
    "arr.dtype"
   ],
   "id": "ef0375a631d844b0",
   "outputs": [
    {
     "data": {
      "text/plain": [
       "dtype('int64')"
      ]
     },
     "execution_count": 6,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "execution_count": 6
  },
  {
   "metadata": {
    "ExecuteTime": {
     "end_time": "2025-01-25T12:41:25.084491Z",
     "start_time": "2025-01-25T12:41:25.078130Z"
    }
   },
   "cell_type": "code",
   "source": [
    "# 那么当我们为其中一个元素赋值为float时，会怎么样？\n",
    "# 如下将arr[0， 0]更改为一个float类型的1.0\n",
    "arr[0, 0] = 2.3\n",
    "arr, arr.dtype"
   ],
   "id": "d88d364a6b4d5c65",
   "outputs": [
    {
     "data": {
      "text/plain": [
       "(array([[2, 2, 3],\n",
       "        [4, 5, 6]]),\n",
       " dtype('int64'))"
      ]
     },
     "execution_count": 7,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "execution_count": 7
  },
  {
   "metadata": {},
   "cell_type": "markdown",
   "source": [
    "发现上面的结果是2而非2.3，而且dtype还是int64，这是因为在ndarray创建时其dtype就确定了，没有显示更改就不会变化，上面的操作相当于C语言中给一个int型变量赋值一个float型变量，结果会**截断**。\n",
    "那么如果真的想要修改该ndarray中的类型呢，使用`.astype()`方法"
   ],
   "id": "afa2ce94982b511a"
  },
  {
   "metadata": {
    "ExecuteTime": {
     "end_time": "2025-01-25T12:41:26.077650Z",
     "start_time": "2025-01-25T12:41:26.071059Z"
    }
   },
   "cell_type": "code",
   "source": [
    "# 注意astype不更改原数组，而是返回一个新的数组（深拷贝）\n",
    "arr.astype(float), arr"
   ],
   "id": "4371f9ee1fc741d2",
   "outputs": [
    {
     "data": {
      "text/plain": [
       "(array([[2., 2., 3.],\n",
       "        [4., 5., 6.]]),\n",
       " array([[2, 2, 3],\n",
       "        [4, 5, 6]]))"
      ]
     },
     "execution_count": 8,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "execution_count": 8
  },
  {
   "metadata": {
    "ExecuteTime": {
     "end_time": "2025-01-25T12:43:33.261977Z",
     "start_time": "2025-01-25T12:43:33.256943Z"
    }
   },
   "cell_type": "code",
   "source": [
    "# 转化为字符串类型\n",
    "arr_str = arr.astype('str')\n",
    "arr_str,"
   ],
   "id": "e268ed033afd311f",
   "outputs": [
    {
     "data": {
      "text/plain": [
       "(array([['2', '2', '3'],\n",
       "        ['4', '5', '6']], dtype='<U21'),)"
      ]
     },
     "execution_count": 16,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "execution_count": 16
  },
  {
   "metadata": {
    "ExecuteTime": {
     "end_time": "2025-01-25T12:44:18.407744Z",
     "start_time": "2025-01-25T12:44:18.402309Z"
    }
   },
   "cell_type": "code",
   "source": [
    "# 创建时就指定类型\n",
    "tmp = np.array(l, dtype='str')\n",
    "tmp,"
   ],
   "id": "685bc6aaba6fff80",
   "outputs": [
    {
     "data": {
      "text/plain": [
       "(array([['1', '2', '3'],\n",
       "        ['4', '5', '6']], dtype='<U1'),)"
      ]
     },
     "execution_count": 18,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "execution_count": 18
  },
  {
   "metadata": {
    "ExecuteTime": {
     "end_time": "2025-01-25T12:46:09.230162Z",
     "start_time": "2025-01-25T12:46:09.224227Z"
    }
   },
   "cell_type": "code",
   "source": [
    "# 创建全0矩阵，传入需要创建的矩阵的shape\n",
    "np.zeros(shape=(23, 3)),"
   ],
   "id": "41cb43ebe6be4fb8",
   "outputs": [
    {
     "data": {
      "text/plain": [
       "(array([[0., 0., 0.],\n",
       "        [0., 0., 0.],\n",
       "        [0., 0., 0.],\n",
       "        [0., 0., 0.],\n",
       "        [0., 0., 0.],\n",
       "        [0., 0., 0.],\n",
       "        [0., 0., 0.],\n",
       "        [0., 0., 0.],\n",
       "        [0., 0., 0.],\n",
       "        [0., 0., 0.],\n",
       "        [0., 0., 0.],\n",
       "        [0., 0., 0.],\n",
       "        [0., 0., 0.],\n",
       "        [0., 0., 0.],\n",
       "        [0., 0., 0.],\n",
       "        [0., 0., 0.],\n",
       "        [0., 0., 0.],\n",
       "        [0., 0., 0.],\n",
       "        [0., 0., 0.],\n",
       "        [0., 0., 0.],\n",
       "        [0., 0., 0.],\n",
       "        [0., 0., 0.],\n",
       "        [0., 0., 0.]]),)"
      ]
     },
     "execution_count": 21,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "execution_count": 21
  },
  {
   "metadata": {
    "ExecuteTime": {
     "end_time": "2025-01-25T12:49:20.479676Z",
     "start_time": "2025-01-25T12:49:20.475026Z"
    }
   },
   "cell_type": "code",
   "source": [
    "# 创建ndarray，填充等差数列，如下的意思是创建一个“从0开始，每次增2，直到（不包括）100”的向量\n",
    "tmp = np.arange(0, 100, 2)\n",
    "tmp"
   ],
   "id": "a08838bb6dc1492a",
   "outputs": [
    {
     "data": {
      "text/plain": [
       "array([ 0,  2,  4,  6,  8, 10, 12, 14, 16, 18, 20, 22, 24, 26, 28, 30, 32,\n",
       "       34, 36, 38, 40, 42, 44, 46, 48, 50, 52, 54, 56, 58, 60, 62, 64, 66,\n",
       "       68, 70, 72, 74, 76, 78, 80, 82, 84, 86, 88, 90, 92, 94, 96, 98])"
      ]
     },
     "execution_count": 24,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "execution_count": 24
  },
  {
   "metadata": {
    "ExecuteTime": {
     "end_time": "2025-01-25T12:51:23.754903Z",
     "start_time": "2025-01-25T12:51:23.739913Z"
    }
   },
   "cell_type": "code",
   "source": [
    "# 通过reshape将更改其大小，但是要保证reshape的目标矩阵的元素数量与原来元素数量一致，默认按照行切割，如下会抛出异常\n",
    "tmp.reshape((5, 20))"
   ],
   "id": "8567e8bc429fa9b9",
   "outputs": [
    {
     "ename": "ValueError",
     "evalue": "cannot reshape array of size 50 into shape (5,20)",
     "output_type": "error",
     "traceback": [
      "\u001B[0;31m---------------------------------------------------------------------------\u001B[0m",
      "\u001B[0;31mValueError\u001B[0m                                Traceback (most recent call last)",
      "Cell \u001B[0;32mIn[29], line 2\u001B[0m\n\u001B[1;32m      1\u001B[0m \u001B[38;5;66;03m# 通过reshape将更改其大小，但是要保证reshape的目标矩阵的元素数量与原来元素数量一致，默认按照行切割，如下会抛出异常\u001B[39;00m\n\u001B[0;32m----> 2\u001B[0m \u001B[43mtmp\u001B[49m\u001B[38;5;241;43m.\u001B[39;49m\u001B[43mreshape\u001B[49m\u001B[43m(\u001B[49m\u001B[43m(\u001B[49m\u001B[38;5;241;43m5\u001B[39;49m\u001B[43m,\u001B[49m\u001B[43m \u001B[49m\u001B[38;5;241;43m20\u001B[39;49m\u001B[43m)\u001B[49m\u001B[43m)\u001B[49m\n",
      "\u001B[0;31mValueError\u001B[0m: cannot reshape array of size 50 into shape (5,20)"
     ]
    }
   ],
   "execution_count": 29
  },
  {
   "metadata": {
    "ExecuteTime": {
     "end_time": "2025-01-25T12:52:56.030167Z",
     "start_time": "2025-01-25T12:52:56.024516Z"
    }
   },
   "cell_type": "code",
   "source": "tmp.reshape((5, 10))",
   "id": "cc4a1fede9f44ae",
   "outputs": [
    {
     "data": {
      "text/plain": [
       "array([[ 0,  2,  4,  6,  8, 10, 12, 14, 16, 18],\n",
       "       [20, 22, 24, 26, 28, 30, 32, 34, 36, 38],\n",
       "       [40, 42, 44, 46, 48, 50, 52, 54, 56, 58],\n",
       "       [60, 62, 64, 66, 68, 70, 72, 74, 76, 78],\n",
       "       [80, 82, 84, 86, 88, 90, 92, 94, 96, 98]])"
      ]
     },
     "execution_count": 34,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "execution_count": 34
  },
  {
   "metadata": {
    "ExecuteTime": {
     "end_time": "2025-01-25T12:52:11.224364Z",
     "start_time": "2025-01-25T12:52:11.218688Z"
    }
   },
   "cell_type": "code",
   "source": [
    "# 可以通过给一个维度设置-1让numpy自己计算，如下种方式的结果本质上是一样的\n",
    "tmp.reshape((5, -1)), tmp.reshape((-1, 10))"
   ],
   "id": "f6695d84a71b19e4",
   "outputs": [
    {
     "data": {
      "text/plain": [
       "(array([[ 0,  2,  4,  6,  8, 10, 12, 14, 16, 18],\n",
       "        [20, 22, 24, 26, 28, 30, 32, 34, 36, 38],\n",
       "        [40, 42, 44, 46, 48, 50, 52, 54, 56, 58],\n",
       "        [60, 62, 64, 66, 68, 70, 72, 74, 76, 78],\n",
       "        [80, 82, 84, 86, 88, 90, 92, 94, 96, 98]]),\n",
       " array([[ 0,  2,  4,  6,  8, 10, 12, 14, 16, 18],\n",
       "        [20, 22, 24, 26, 28, 30, 32, 34, 36, 38],\n",
       "        [40, 42, 44, 46, 48, 50, 52, 54, 56, 58],\n",
       "        [60, 62, 64, 66, 68, 70, 72, 74, 76, 78],\n",
       "        [80, 82, 84, 86, 88, 90, 92, 94, 96, 98]]))"
      ]
     },
     "execution_count": 31,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "execution_count": 31
  },
  {
   "metadata": {},
   "cell_type": "markdown",
   "source": "#### 比较list与ndarray",
   "id": "7319df2267b1ea06"
  },
  {
   "metadata": {},
   "cell_type": "markdown",
   "source": "numpy 的数据结构是n维的数组对象，叫做ndarray。Python 的 list 虽然也能表示，但是不高效，随着列表数据的增加，效率会降低。",
   "id": "220fc608ef510e9f"
  },
  {
   "metadata": {
    "ExecuteTime": {
     "end_time": "2025-01-25T12:56:41.854026Z",
     "start_time": "2025-01-25T12:56:41.788662Z"
    }
   },
   "cell_type": "code",
   "source": [
    "# 构造一个比较大的list和ndarray（1e6个元素）\n",
    "l = [i for i in range(10**6)]\n",
    "arr = np.array(l)"
   ],
   "id": "6cfc01086d1f1762",
   "outputs": [],
   "execution_count": 35
  },
  {
   "metadata": {
    "ExecuteTime": {
     "end_time": "2025-01-25T12:57:38.999911Z",
     "start_time": "2025-01-25T12:57:38.953525Z"
    }
   },
   "cell_type": "code",
   "source": [
    "# 使用list的方式求每个元素的平方\n",
    "l_square = [i*i for i in l]"
   ],
   "id": "b91c0a6207bb84d3",
   "outputs": [],
   "execution_count": 36
  },
  {
   "metadata": {},
   "cell_type": "markdown",
   "source": [
    "使用ndarray求每个元素的平方，可以使用ndarray重载的`*`运算符，它表示将两个shape一样的ndarray按元素相乘（如果shape不一样时会尝试使用广播机制，如果广播也失效时会报错）\n",
    "广播：$[2] * [1, 2, 3] -> [2, 2, 2] * [1, 2, 3] = [2, 4, 6]$"
   ],
   "id": "488b8ed0c17743d3"
  },
  {
   "metadata": {
    "ExecuteTime": {
     "end_time": "2025-01-25T13:01:53.775193Z",
     "start_time": "2025-01-25T13:01:53.757660Z"
    }
   },
   "cell_type": "code",
   "source": [
    "# 可以看到明显快于list，实际在数据量大时差距更大\n",
    "arr_square = arr * arr"
   ],
   "id": "e79f4f53d33b761f",
   "outputs": [],
   "execution_count": 37
  },
  {
   "metadata": {},
   "cell_type": "markdown",
   "source": "ndarray重载了`==`运算符，可以按元素判断对应元素是否一样",
   "id": "e479130b29d8c9ee"
  },
  {
   "metadata": {
    "ExecuteTime": {
     "end_time": "2025-01-25T13:04:09.509059Z",
     "start_time": "2025-01-25T13:04:09.474890Z"
    }
   },
   "cell_type": "code",
   "source": "l == arr",
   "id": "c221e3dd2efab549",
   "outputs": [
    {
     "data": {
      "text/plain": [
       "array([ True,  True,  True, ...,  True,  True,  True], shape=(1000000,))"
      ]
     },
     "execution_count": 39,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "execution_count": 39
  },
  {
   "metadata": {
    "ExecuteTime": {
     "end_time": "2025-01-25T13:05:17.575384Z",
     "start_time": "2025-01-25T13:05:17.244597Z"
    }
   },
   "cell_type": "code",
   "source": [
    "# 看一个二维的例子\n",
    "l = [[i for i in range(10)] for j in range(10**5)]\n",
    "arr = np.array(l)"
   ],
   "id": "68cca1a5c376805d",
   "outputs": [],
   "execution_count": 40
  },
  {
   "metadata": {
    "ExecuteTime": {
     "end_time": "2025-01-25T13:05:42.943162Z",
     "start_time": "2025-01-25T13:05:42.818559Z"
    }
   },
   "cell_type": "code",
   "source": "l_square = [[i*i for i in j] for j in l]",
   "id": "bcb7732533216411",
   "outputs": [],
   "execution_count": 41
  },
  {
   "metadata": {
    "ExecuteTime": {
     "end_time": "2025-01-25T13:05:52.637157Z",
     "start_time": "2025-01-25T13:05:52.631337Z"
    }
   },
   "cell_type": "code",
   "source": "arr_square = arr * arr # 可以看到差距更大了",
   "id": "eca42628429b39bb",
   "outputs": [],
   "execution_count": 42
  },
  {
   "metadata": {},
   "cell_type": "markdown",
   "source": "#### 常用的函数",
   "id": "52021eed8a72757"
  },
  {
   "metadata": {
    "ExecuteTime": {
     "end_time": "2025-01-25T13:09:43.111626Z",
     "start_time": "2025-01-25T13:09:43.105727Z"
    }
   },
   "cell_type": "code",
   "source": [
    "tmp = np.arange(0, 20)\n",
    "tmp"
   ],
   "id": "dcdf1bb0d19be316",
   "outputs": [
    {
     "data": {
      "text/plain": [
       "array([ 0,  1,  2,  3,  4,  5,  6,  7,  8,  9, 10, 11, 12, 13, 14, 15, 16,\n",
       "       17, 18, 19])"
      ]
     },
     "execution_count": 48,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "execution_count": 48
  },
  {
   "metadata": {
    "ExecuteTime": {
     "end_time": "2025-01-25T13:08:16.248704Z",
     "start_time": "2025-01-25T13:08:16.242866Z"
    }
   },
   "cell_type": "code",
   "outputs": [
    {
     "data": {
      "text/plain": [
       "(np.int64(190),\n",
       " np.float64(9.5),\n",
       " np.int64(19),\n",
       " np.int64(0),\n",
       " np.float64(5.766281297335398))"
      ]
     },
     "execution_count": 47,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "execution_count": 47,
   "source": [
    "# sum、mean、max、min、std\n",
    "tmp.sum(), tmp.mean(), tmp.max(), tmp.min(), tmp.std()"
   ],
   "id": "c2137d24f2bebdd4"
  },
  {
   "metadata": {
    "ExecuteTime": {
     "end_time": "2025-01-25T13:12:05.102203Z",
     "start_time": "2025-01-25T13:12:05.083135Z"
    }
   },
   "cell_type": "code",
   "source": [
    "# reshape成为一个第0维长度为4，第1维长度自适应的矩阵，实际是（4*5）\n",
    "reshaped = tmp.reshape(4, -1)\n",
    "reshaped, reshaped.shape"
   ],
   "id": "4b16c2f721212086",
   "outputs": [
    {
     "data": {
      "text/plain": [
       "(array([[ 0,  1,  2,  3,  4],\n",
       "        [ 5,  6,  7,  8,  9],\n",
       "        [10, 11, 12, 13, 14],\n",
       "        [15, 16, 17, 18, 19]]),\n",
       " (4, 5))"
      ]
     },
     "execution_count": 51,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "execution_count": 51
  },
  {
   "metadata": {
    "ExecuteTime": {
     "end_time": "2025-01-25T13:12:34.092713Z",
     "start_time": "2025-01-25T13:12:34.087287Z"
    }
   },
   "cell_type": "code",
   "source": [
    "# 转置T或transpose\n",
    "reshaped_T = reshaped.transpose()\n",
    "reshaped, reshaped_T"
   ],
   "id": "714646f12d2e800a",
   "outputs": [
    {
     "data": {
      "text/plain": [
       "(array([[ 0,  1,  2,  3,  4],\n",
       "        [ 5,  6,  7,  8,  9],\n",
       "        [10, 11, 12, 13, 14],\n",
       "        [15, 16, 17, 18, 19]]),\n",
       " array([[ 0,  5, 10, 15],\n",
       "        [ 1,  6, 11, 16],\n",
       "        [ 2,  7, 12, 17],\n",
       "        [ 3,  8, 13, 18],\n",
       "        [ 4,  9, 14, 19]]))"
      ]
     },
     "execution_count": 52,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "execution_count": 52
  },
  {
   "metadata": {},
   "cell_type": "markdown",
   "source": "ps:使用`numpy.full_like(arr, value)`可以获得一个和arr的shape一样形状的ndarray，并且其中每个元素都是value。`numpy.full(shape, value)`则是需要传入一个shape。**在numpy中xx是一个创建ndarray的方法，其传入的第一个参数基本都是shape，而对应的xx_like则传入的第一个参数是一个ndarray，它们完成一样的逻辑**",
   "id": "c7f37e5db8dd575d"
  },
  {
   "metadata": {
    "ExecuteTime": {
     "end_time": "2025-01-25T13:23:37.410446Z",
     "start_time": "2025-01-25T13:23:37.405039Z"
    }
   },
   "cell_type": "code",
   "source": [
    "# exp\n",
    "# 构造一个shape=(4,5)且全都是2的ndarray\n",
    "tmp_2 = np.full_like(reshaped, 2)\n",
    "np.exp(tmp_2), np.exp(reshaped)"
   ],
   "id": "daac1152f00abdcb",
   "outputs": [
    {
     "data": {
      "text/plain": [
       "(array([[7.3890561, 7.3890561, 7.3890561, 7.3890561, 7.3890561],\n",
       "        [7.3890561, 7.3890561, 7.3890561, 7.3890561, 7.3890561],\n",
       "        [7.3890561, 7.3890561, 7.3890561, 7.3890561, 7.3890561],\n",
       "        [7.3890561, 7.3890561, 7.3890561, 7.3890561, 7.3890561]]),\n",
       " array([[1.00000000e+00, 2.71828183e+00, 7.38905610e+00, 2.00855369e+01,\n",
       "         5.45981500e+01],\n",
       "        [1.48413159e+02, 4.03428793e+02, 1.09663316e+03, 2.98095799e+03,\n",
       "         8.10308393e+03],\n",
       "        [2.20264658e+04, 5.98741417e+04, 1.62754791e+05, 4.42413392e+05,\n",
       "         1.20260428e+06],\n",
       "        [3.26901737e+06, 8.88611052e+06, 2.41549528e+07, 6.56599691e+07,\n",
       "         1.78482301e+08]]))"
      ]
     },
     "execution_count": 55,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "execution_count": 55
  },
  {
   "metadata": {},
   "cell_type": "code",
   "outputs": [],
   "execution_count": null,
   "source": "",
   "id": "536e5edf886e4a2d"
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 2
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython2",
   "version": "2.7.6"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 5
}
